package org.example.hotel.controller;

import org.example.hotel.dto.ReportDTO;
import org.example.hotel.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;

@RestController
@RequestMapping("/api/manager")
public class ManagerController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/report")
    public ReportDTO getReport(
            @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate start,
            @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate end,
            @RequestParam(required = false) Integer roomId) {
        return reportService.generateReport(start, end, roomId);
    }
}
